package guowenlong.golf.ui.personal.myteam;

import android.content.DialogInterface;
import android.os.Bundle;
import android.support.v7.app.AlertDialog;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import butterknife.Unbinder;
import guowenlong.golf.R;
import guowenlong.golf.base.BaseFragment;

/**
 * des   : 描述
 * author: Administrator
 * email : guowenlong20000@gmail.com
 * time  : 2017年03月29日 下午 5:32.
 */

public class FragmentTeamMember extends BaseFragment {

  @BindView(R.id.tv_edit1)
  TextView tvEdit1;
  @BindView(R.id.tv_edit2)
  TextView tvEdit2;
  Unbinder unbinder;

  @Override
  public int getLayoutId() {
    return R.layout.fragment_team_member;
  }

  @Override
  public void initData(Bundle savedInstanceState) {

  }

  @Override
  public void initView() {
  }

  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container,
      Bundle savedInstanceState) {
    // TODO: inflate a fragment view
    View rootView = super.onCreateView(inflater, container, savedInstanceState);
    unbinder = ButterKnife.bind(this, rootView);
    return rootView;
  }

  @Override
  public void onDestroyView() {
    super.onDestroyView();
    unbinder.unbind();
  }

  @OnClick({R.id.tv_edit1, R.id.tv_edit2})
  public void onViewClicked(View view) {
    switch (view.getId()) {
      case R.id.tv_edit1:
        String content1 = tvEdit1.getText().toString();
        switch (content1) {
          case "编辑":
            tvEdit1.setText("删除球员");
            tvEdit1.setTextColor(getActivity().getResources().getColor(R.color.front_red));
            break;
          case "删除球员":
            final AlertDialog.Builder normalDialog =
                new AlertDialog.Builder(getActivity());
            normalDialog.setMessage("删除当前球员");
            normalDialog.setPositiveButton("取消",
                new DialogInterface.OnClickListener() {
                  @Override
                  public void onClick(DialogInterface dialog, int which) {
                  }
                });
            normalDialog.setNegativeButton("删除",
                new DialogInterface.OnClickListener() {
                  @Override
                  public void onClick(DialogInterface dialog, int which) {
                  }
                });
            normalDialog.show();
            break;
        }
        break;
      case R.id.tv_edit2:
        String content2 = tvEdit2.getText().toString();
        switch (content2) {
          case "编辑":
            tvEdit2.setText("删除球员");
            tvEdit2.setTextColor(getActivity().getResources().getColor(R.color.front_red));
            break;
          case "删除球员":
            break;
        }
        break;
    }
  }
}
